package com.cashmama.market.api.application.controller.order.request;

import com.cashmama.market.api.infras.utils.ParamsValidateUtil;
import com.cashmama.market.api.infras.utils.StringUtils;
import com.fqgj.common.api.ParamsObject;

/**
 * @program: market-api
 * @description
 * @author: frank
 * @create: 2020-03-11 10:54
 **/
public class OfflineOrderSubmitRequest extends ParamsObject {

    private String tradeNo;
    private String repaymentAmount;
    private String beneficiaryName;
    private String beneficiaryAccNo;
    private String ifscCode;
    private String transactionId;
    private String transactionImgUrl;

    public String getTradeNo() {
        return tradeNo;
    }

    public OfflineOrderSubmitRequest setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
        return this;
    }

    public String getRepaymentAmount() {
        return repaymentAmount;
    }

    public OfflineOrderSubmitRequest setRepaymentAmount(String repaymentAmount) {
        this.repaymentAmount = repaymentAmount;
        return this;
    }

    public String getBeneficiaryName() {
        return beneficiaryName;
    }

    public OfflineOrderSubmitRequest setBeneficiaryName(String beneficiaryName) {
        this.beneficiaryName = beneficiaryName;
        return this;
    }

    public String getBeneficiaryAccNo() {
        return beneficiaryAccNo;
    }

    public OfflineOrderSubmitRequest setBeneficiaryAccNo(String beneficiaryAccNo) {
        this.beneficiaryAccNo = beneficiaryAccNo;
        return this;
    }

    public String getIfscCode() {
        return ifscCode;
    }

    public OfflineOrderSubmitRequest setIfscCode(String ifscCode) {
        this.ifscCode = ifscCode;
        return this;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public OfflineOrderSubmitRequest setTransactionId(String transactionId) {
        this.transactionId = transactionId;
        return this;
    }

    public String getTransactionImgUrl() {
        return transactionImgUrl;
    }

    public OfflineOrderSubmitRequest setTransactionImgUrl(String transactionImgUrl) {
        this.transactionImgUrl = transactionImgUrl;
        return this;
    }

    @Override
    public void validate() {
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(tradeNo), "tradeNo can not be empty");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(repaymentAmount), "repaymentAmount can not be empty");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(beneficiaryName), "beneficiaryName can not be empty");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(beneficiaryAccNo), "beneficiaryAccNo can not be empty");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(ifscCode), "ifscCode can not be empty");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(transactionId), "transactionId can not be empty");
        ParamsValidateUtil.checkParams(transactionId.length() >= 64, "Data too long for transactionId");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(transactionImgUrl), "transactionImgUrl can not be empty");
    }
}
